}
g_clear_pointer (&device->name, g_free);
- g_clear_pointer (&device->keys, g_free);
g_clear_pointer (&device->vendor_id, g_free);
g_clear_pointer (&device->product_id, g_free);
return device->source;
}
-/**
- * gdk_device_get_n_keys:
- * @device: a #GdkDevice
- *
- * Returns the number of keys the device currently has.
- *
- * Returns: the number of keys.
- **/
-gint
-gdk_device_get_n_keys (GdkDevice *device)
-{
- g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
-
- return device->num_keys;
-}
-
-/**
- * gdk_device_get_key:
- * @device: a #GdkDevice.
- * @index_: the index of the macro button to get.
- * @keyval: (out): return value for the keyval.
- * @modifiers: (out): return value for modifiers.
- *
- * If @index_ has a valid keyval, this function will return %TRUE
- * and fill in @keyval and @modifiers with the keyval settings.
- *
- * Returns: %TRUE if keyval is set for @index.
- **/
-gboolean
-gdk_device_get_key (GdkDevice *device,
- guint index_,
- guint *keyval,
- GdkModifierType *modifiers)
-{
- g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
- g_return_val_if_fail (index_ < device->num_keys, FALSE);
-
- if (!device->keys[index_].keyval &&
- !device->keys[index_].modifiers)
- return FALSE;
-
- if (keyval)
- *keyval = device->keys[index_].keyval;
-
- if (modifiers)
- *modifiers = device->keys[index_].modifiers;
-
- return TRUE;
-}
-
-/**
- * gdk_device_set_key:
- * @device: a #GdkDevice
- * @index_: the index of the macro button to set
- * @keyval: the keyval to generate
- * @modifiers: the modifiers to set
- *
- * Specifies the X key event to generate when a macro button of a device
- * is pressed.
- **/
-void
-gdk_device_set_key (GdkDevice *device,
- guint index_,
- guint keyval,
- GdkModifierType modifiers)
-{
- g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (index_ < device->num_keys);
-
- device->keys[index_].keyval = keyval;
- device->keys[index_].modifiers = modifiers;
-}
-
/**
* gdk_device_get_axis_use:
* @device: a pointer #GdkDevice.
*resolution = info->resolution;
}
-void
-_gdk_device_set_keys (GdkDevice *device,
- guint num_keys)
-{
- g_free (device->keys);
-
- device->num_keys = num_keys;
- device->keys = g_new0 (GdkDeviceKey, num_keys);
-}
-
static GdkAxisInfo *
find_axis_info (GArray *array,
GdkAxisUse use)
#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))
typedef struct _GdkDeviceClass GdkDeviceClass;
-typedef struct _GdkDeviceKey GdkDeviceKey;
-
-struct _GdkDeviceKey
-{
- guint keyval;
- GdkModifierType modifiers;
-};
struct _GdkDevice
{
gchar *name;
GdkInputSource source;
gboolean has_cursor;
- gint num_keys;
GdkAxisFlags axis_flags;
- GdkDeviceKey *keys;
GdkDisplay *display;
/* Paired master for master,
* associated master for slaves
gdouble *max_value,
gdouble *resolution);
-void _gdk_device_set_keys (GdkDevice *device,
- guint num_keys);
-
gboolean _gdk_device_translate_surface_coord (GdkDevice *device,
GdkSurface *surface,
guint index,